package com.sxbbc.common.core.enums;

import java.util.ArrayList;
import java.util.List;

import com.sxbbc.common.basics.utils.calculation.CalcuUtils;

/**
 * @author xiaoky
 * @description 发货方式枚举
 * @date 2019-05-14
 */
public enum ReceivedTypeEnums {
	EXP(1,"物流发货",true),
	OWN(2,"门店自提",true),
	VIRTUA(3, "虚拟发货",false);
	private Integer id;
	 
    private String name;

    private boolean valid;
    
    public Integer getId() {
		return id;
	}
	
	public void setId(Integer id) {
		this.id = id;
	}
	
	public String getName() {
		return name;
	}
	
	public void setName(String name) {
		this.name = name;
	}

	public boolean isValid() {
		return valid;
	}

	public void setValid(boolean valid) {
		this.valid = valid;
	}

	private ReceivedTypeEnums(Integer id, String name,boolean valid){
		this.id=id;
		this.name=name;
		this.valid=valid;
	}
	
	public static String getName(Integer id){
		String str="";
		for(ReceivedTypeEnums o:ReceivedTypeEnums.values()){
			if(CalcuUtils.getInstance().isEquals(id, o.getId())){
				str= o.getName();
				break;
			}
		}
		return str;
	}
	
	public static List<ReceivedTypeEnums> queryList(){
		List<ReceivedTypeEnums> list=new ArrayList<ReceivedTypeEnums>();
		for(ReceivedTypeEnums o:ReceivedTypeEnums.values()){
			if (o.isValid()) {
				list.add(o);
			}
		}
		return list;
	}
	
}
